{{include file="default/Public/header.html"}}
<div id="pageTop">
	<div class="tabs"> 
		<ul>
			<li><a href='{{U url="fsurvey/add?catid=`$cat.catid`"}}'>添加问卷</a></li>
		</ul>
	</div>
</div>
<div id="pageCo">

	<div class="manageForm">
		<form name="myform" class="validate" method="post" action="{{U url='fsurvey/add_question?dosubmit=1'}}" >
		<table cellpadding="0" cellspacing="0" class="tabcontent" id="tabsContent1">
			<thead>
				<tr>
					<th colspan="2">新加问卷问题</th>
				</tr>
			</thead>
			<tr>
				<th align="right" width="200">问题</th>
				<td><input type="text" name="info[subject]" value="" size="60" class="required input" /></td>
			</tr>
			<tr>
				<th>问题类型</th>
				<td><input type="radio" name="info[type]" value="0" checked="checked" />单选&nbsp;
				        <input type="radio" name="info[type]" value="1" id="checkbox" />
				        多选&nbsp;<input type="radio" name="info[type]" value="2" />文本&nbsp;&nbsp;&nbsp;&nbsp;
				        <span id="range_1" style="display:none">
				        最少选择<input type="text" name="option[minval]"  value="1" size="3" />项 &nbsp;&nbsp;
				        最多选择<input type="text" name="option[maxval]"  value="0" size="3" />项
				        </span>
						
				        <span id="range_2" style="display:none">
				        行数<input type="text" name="option[rows]"  value="1" size="3" /> &nbsp;&nbsp;
				        列数<input type="text" name="option[cols]"  value="1" size="3" />
				        </span>

				        <span id="range_3">
				        | 额外 附加文本<input type="radio" name="option[fujia]"  value="1" />
				        </span>

						</td>
			</tr>

			<tr id="range_4" >
				<th>问卷项<span>提示:图片也可以直接填写远程图片地址</span></th>
				<td><input type="button" value="添加选项" id="addItem1" />
       					<input type="button" value="减少选项" id="descItem1" />
       					<div id="option_list_1">
       						<p>
       							<span>1</span>、<input type="text" name="info[option][]" size="40" class="required input" msg="必填" id="opt1" ids="option"/>
       							图片:<input type="text" name="info[image][]" id="pic1" size="18" /><input type="button" value="上传图片" id="upload_img_1" class="dialog" title="从电脑上传图片" alt="__ROOT__/admin.php?m=fupload&a=commonUpload&opener_id=pic1&height=300&width=450">
       						</p>
       						<p>
       							<span>2</span>、<input type="text" name="info[option][]" size="40" class="required input" msg="必填" id="opt2" ids="option"/>
       							图片:<input type="text" name="info[image][]" id="pic2" size="18" /><input type="button" value="上传图片" id="upload_img_2" class="dialog" title="从电脑上传图片" alt="__ROOT__/admin.php?m=fupload&a=commonUpload&opener_id=pic2&height=300&width=450">
       						</p>
       					</div></td>
			</tr>

			<tr>
				<th>排序</th>
				<td><input type="text" name="info[order]" value="0" size="6" /></td>
			</tr>

			<tr>
				<th>启用</th>
				<td><input name="info[status]" type="radio" value="1" checked="checked" />是&nbsp;&nbsp;
        		<input type="radio" name="info[status]" value="0" />否</td>
			</tr>

			<tr>
				<th>&nbsp;</th>
				<td><label class="btn"><input type="submit" name="submit" value="确 定" class="submit" /></label>
    				<label class="btn"><input type="reset" name="reset" value="重 置" class="submit" /></label></td>
			</tr>
			</tr>
		</table>
		<input type="hidden" name="catid" value="{{$cat.catid}}" />
		<input type="hidden" name="info[surid]" value="{{$surid}}" />
		<input type="hidden" name="forward" value='{{U url="fsurvey/manage_question?catid=`$cat.catid`&surid=`$surid`"}}' />
		</form> 
	</div>
</div>
<script type="text/javascript">
var option_num = 3;
	$(function(){
		$('input[name="info[type]"]').change(function(){
			if(this.value==1) {
				$('#range_2').hide();
				$('#range_1').show();
				$('#range_3').show();
				$('#range_4').show();

			} else if(this.value==2)
			{
				$('#range_1').hide();
				$('#range_2').show();
				$('#range_3').hide();
				$('#range_4').hide();

			}else if(this.value==0)
			{
				$('#range_1').hide();
				$('#range_2').hide();
				$('#range_3').show();
				$('#range_4').show();
			}
		});
		
		//添加选项
		$('#addItem1').click(function(){
			var d_obj = $('#option_list_1');
			var p_len = d_obj.children('p').length;
			d_obj.append('<p><span>'+parseInt(p_len+1)+'</span>、<input type="text" name="info[option][]" size="40" class="required input" msg="必填" id="opt'+option_num+'" /> 图片:<input type="text" name="info[image][]" id="pic'+option_num+'" size="18" /><input type="button" value="上传图片" id="upload_img_'+option_num+'" class="dialog" title="从电脑上传图片" alt="__ROOT__/admin.php?m=fupload&a=commonUpload&opener_id=pic'+option_num+'&height=300&width=450"></p>');
			
			window.parent.mainCo && window.parent.mainCo();
			$('#opt'+option_num).focus().blur();
			option_num++;
		});
		//减少选项
		$('#descItem1').click(function(){
			var d_obj = $('#option_list_1');
			var _p = d_obj.children('p');
			var p_len = _p.length;
			if(p_len>2) {
				$(_p[p_len-1]).remove();
				window.parent.mainCo && window.parent.mainCo();
				$('#opt'+option_num).focus().blur();
			}
		});
	});
</script>
{{include file="default/Public/footer.html"}}